# -*- coding: utf-8 -*-
# @Time: 2025/6/29 21:53
# @Author: wzd
# @Email: 2146333089@qq.com
# @File: cor_enhance.py
def ocr_enhance(image_path):
    """对图片内容进行OCR增强"""
    from paddleocr import PaddleOCR

    ocr = PaddleOCR(use_angle_cls=True, lang="ch", use_gpu=False)
    result = ocr.ocr(str(image_path), cls=True)

    ocr_text = []
    for line in result:
        for word_info in line:
            text = word_info[1][0]
            confidence = word_info[1][1]
            if confidence > 0.8:  # 只保留高置信度识别
                ocr_text.append(text)

    return " ".join(ocr_text)